﻿<UserControl x:Class="DiscoveryLogic.Analytics.Modules.DataNavigation.NetworkTreeView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:BusinessLogic="clr-namespace:DiscoveryLogic.Analytics.BusinessLogic;assembly=Analytics.BusinessLogic"
    HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
    Loaded="UserControl_Loaded">
    <UserControl.ContextMenu>
        <ContextMenu>
            <MenuItem
                x:Name="cmuViewNetwork" Header="View network graph" Tag="/images/graph.png"
                Click="cmuNetworkGraph_Click"/>
            <MenuItem 
                x:Name="cmuViewRadial" Header="View radial graph" Tag="/images/graph.png"
                Click="cmuRadialGraph_Click"/>
            <MenuItem 
                x:Name="cmuOpenNetwork" Header="View network data" Tag="/images/open.png"
                Click="cmuNetworkData_Click"/>
            <MenuItem
                x:Name="cmuNetworkStats" Header="View network measures" Tag="/images/stats.png"
                Click="cmuNetworkStats_Click"/>
            <MenuItem
                x:Name="cmuDeleteNetwork" Header="Delete network" Tag="/images/delete.bmp"
                Click="cmuDeleteNetwork_Click"/>
            <Separator></Separator>
            <MenuItem
                x:Name="cmuGrantToPubs" Header="Grant->Pub" Tag="/images/link.png"
                Click="cmuGrantToPubs_Click"/>
            <MenuItem
                x:Name="cmuGrantToPersons" Header="Grant->Person" Tag="/images/link.png"
                Click="cmuGrantToPersons_Click"/>
            <MenuItem
                x:Name="cmuGrantToOrgs" Header="Grant->Org" Tag="/images/link.png"
                Click="cmuGrantToOrgs_Click"/>
            <MenuItem
                x:Name="cmuPubToOrgs" Header="Pub->Org" Tag="/images/link.png"
                Click="cmuPubToOrgs_Click"/>
            
        </ContextMenu>
    </UserControl.ContextMenu>
        <TreeView 
            x:Name="treeNetworks" 
            ItemsSource="{x:Static BusinessLogic:MyData.AllNetworks}"
            SelectedItemChanged="treeNetworks_SelectedItemChanged"
            HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
            BorderBrush="White" BorderThickness="0" MinWidth="100" MinHeight="400">
            <TreeView.ItemTemplate>
                <HierarchicalDataTemplate ItemsSource="{Binding Path=Networks}">
                    <StackPanel Orientation="Horizontal">
                        <Image Source="/images/folder.ico" Width="16" Margin="0,0,5,0"/>
                        <TextBlock Text="{Binding Path=EntityType}" FontWeight="Bold"/>
                    </StackPanel>
                    <HierarchicalDataTemplate.ItemTemplate>
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal">
                                <Image Source="{Binding Path=IconPath}" Width="16" Margin="0,0,5,0"/>
                                <TextBlock Text="{Binding Path=NetworkName}"/>
                            </StackPanel>
                        </DataTemplate>
                    </HierarchicalDataTemplate.ItemTemplate>
                </HierarchicalDataTemplate>
            </TreeView.ItemTemplate>
        </TreeView>
</UserControl>
